package Test29;

//period类的使用

import java.time.LocalDate;
import java.time.Period;

public class Test14 {
    public static void main(String[] args) {

        //当前本地的  年月日
        LocalDate today = LocalDate.now();
        System.out.println(today);

        //生日的 年月日
        LocalDate birthday = LocalDate.of(2002, 1, 13);
        System.out.println(birthday);

        Period period = Period.between(birthday, today);

        System.out.println("相差的时间间隔对象：" + period);
        System.out.println(period.getYears());
        System.out.println(period.getMonths());
        System.out.println(period.getDays());

        System.out.println(period.toTotalMonths());//相差时间间隔总月份
    }
}
